 -------------------- ******************************************  NON APERI TUTELA    *****************

insert into asm_x_conta_contatori_3

select a.* from asm_x_conta_contatori_2 a,
(
      select pod,max(data_avvio) dav
      from 
(
select * from(
select uno.*,tre.contratto contractor from  asm_x_conta_contatori_2 uno ,asm_x_conta_contatori_3 tre
where uno.pod=tre.pod(+)) xx
where xx.contractor is null
) 
 group by pod
 ) B
where a.data_avvio = b.dav
and a.pod=b.pod
and a.stato_contratto <> 'A'
